home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Actual 85 Febrero 2004.iso / Experto / Apache / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F252764_mod_proxy.xml < prev    next >
Encoding:
Extensible Markup Language  |  2003-07-28  |  41.0 KB  |  969 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
  3. <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
  4. <modulesynopsis metafile="mod_proxy.xml.meta">
  5.  
  6. <name>mod_proxy</name>
  7. <description>HTTP/1.1 proxy/gateway server</description>
  8. <status>Extension</status>
  9. <sourcefile>mod_proxy.c</sourcefile>
  10. <identifier>proxy_module</identifier>
  11.  
  12. <summary>
  13.     <note type="warning"><title>Warning</title>
  14.       <p>Do not enable proxying with <directive module="mod_proxy"
  15.       >ProxyRequests</directive> until you have <a href="#access"
  16.       >secured your server</a>. Open proxy servers are dangerous both to your
  17.       network and to the Internet at large.</p>
  18.     </note>
  19.  
  20.     <p>This module implements a proxy/gateway for Apache. It implements
  21.     proxying capability for <code>FTP</code>, <code>CONNECT</code> (for SSL),
  22.     <code>HTTP/0.9</code>, <code>HTTP/1.0</code>, and <code>HTTP/1.1</code>.
  23.     The module can be configured to connect to other proxy modules for these
  24.     and other protocols.</p>
  25.  
  26.     <p>Apache's proxy features are divided into several modules in
  27.     addition to <module>mod_proxy</module>:
  28.     <module>mod_proxy_http</module>, <module>mod_proxy_ftp</module>
  29.     and <module>mod_proxy_connect</module>.  Thus, if you want to use
  30.     one or more of the particular proxy functions, load
  31.     <module>mod_proxy</module> <em>and</em> the appropriate module(s)
  32.     into the server (either statically at compile-time or dynamically
  33.     via the <directive module="mod_so">LoadModule</directive>
  34.     directive).</p>
  35.  
  36.     <p>In addition, extended features are provided by other modules.
  37.     Caching is provided by <module>mod_cache</module> and related
  38.     modules.  The ability to contact remote servers using the SSL/TLS
  39.     protocol is provided by the <code>SSLProxy*</code> directives of
  40.     <module>mod_ssl</module>.  These additional modules will need
  41.     to be loaded and configured to take advantage of these features.</p>
  42. </summary>
  43. <seealso><module>mod_cache</module></seealso>
  44. <seealso><module>mod_proxy_http</module></seealso>
  45. <seealso><module>mod_proxy_ftp</module></seealso>
  46. <seealso><module>mod_proxy_connect</module></seealso>
  47. <seealso><module>mod_ssl</module></seealso>
  48.  
  49.     <section id="forwardreverse"><title>Forward and Reverse Proxies</title>
  50.       <p>Apache can be configured in both a <dfn>forward</dfn> and
  51.       <dfn>reverse</dfn> proxy mode.</p>
  52.  
  53.       <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
  54.       server that sits between the client and the <em>origin
  55.       server</em>.  In order to get content from the origin server,
  56.       the client sends a request to the proxy naming the origin server
  57.       as the target and the proxy then requests the content from the
  58.       origin server and returns it to the client.  The client must be
  59.       specially configured to use the forward proxy to access other
  60.       sites.</p>
  61.  
  62.       <p>A typical usage of a forward proxy is to provide Internet
  63.       access to internal clients that are otherwise restricted by a
  64.       firewall.  The forward proxy can also use caching (as provided
  65.       by <module>mod_cache</module>) to reduce network usage.</p>
  66.  
  67.       <p>The forward proxy is activated using the <directive
  68.       module="mod_proxy">ProxyRequests</directive> directive.  Because
  69.       forward proxys allow clients to access arbitrary sites through
  70.       your server and to hide their true origin, it is essential that
  71.       you <a href="#access">secure your server</a> so that only
  72.       authorized clients can access the proxy before activating a
  73.       forward proxy.</p>
  74.  
  75.       <p>A <dfn>reverse proxy</dfn>, by contrast, appears to the
  76.       client just like an ordinary web server.  No special
  77.       configuration on the client is necessary.  The client makes
  78.       ordinary requests for content in the name-space of the reverse
  79.       proxy.  The reverse proxy then decides where to send those
  80.       requests, and returns the content as if it was itself the
  81.       origin.</p>
  82.  
  83.       <p>A typical usage of a reverse proxy is to provide Internet
  84.       users access to a server that is behind a firewall.  Reverse
  85.       proxies can also be used to balance load among several back-end
  86.       servers, or to provide caching for a slower back-end server.
  87.       In addition, reverse proxies can be used simply to bring
  88.       several servers into the same URL space.</p>
  89.  
  90.       <p>A reverse proxy is activated using the <directive
  91.       module="mod_proxy">ProxyPass</directive> directive or the
  92.       <code>[P]</code> flag to the <directive
  93.       module="mod_rewrite">RewriteRule</directive> directive.  It is
  94.       <strong>not</strong> necessary to turn <directive
  95.       module="mod_proxy">ProxyRequests</directive> on in order to
  96.       configure a reverse proxy.</p>
  97.     </section> <!-- /forwardreverse -->
  98.  
  99.     <section id="examples"><title>Basic Examples</title>
  100.  
  101.     <p>The examples below are only a very basic idea to help you
  102.     get started.  Please read the documentation on the individual
  103.     directives.</p>
  104.  
  105.     <p>In addition, if you wish to have caching enabled, consult
  106.     the documentation from <module>mod_cache</module>.</p>
  107.  
  108.     <example><title>Forward Proxy</title>
  109.     ProxyRequests On<br />
  110.     ProxyVia On<br />
  111.     <br />
  112.     <Proxy *><br />
  113.     <indent>
  114.       Order deny,allow<br />
  115.       Deny from all<br />
  116.       Allow from internal.example.com<br />
  117.     </indent>
  118.     </Proxy>
  119.     </example>
  120.  
  121.     <example><title>Reverse Proxy</title>
  122.     ProxyRequests Off<br />
  123.     <br />
  124.     <Proxy *><br />
  125.     <indent>
  126.       Order deny,allow<br />
  127.       Allow from all<br />
  128.     </indent>
  129.     </Proxy><br />
  130.     <br />
  131.     ProxyPass /foo http://foo.example.com/bar<br />
  132.     ProxyPassReverse /foo http://foo.example.com/bar
  133.     </example>
  134.     </section> <!-- /examples -->
  135.  
  136.  
  137.     <section id="access"><title>Controlling access to your proxy</title>
  138.       <p>You can control who can access your proxy via the <directive
  139.       module="mod_proxy" type="section">Proxy</directive> control block as in
  140.       the following example:</p>
  141.  
  142.       <example>
  143.         <Proxy *><br />
  144.         <indent>
  145.           Order Deny,Allow<br />
  146.           Deny from all<br />
  147.           Allow from 192.168.0<br />
  148.         </indent>
  149.         </Proxy>
  150.       </example>
  151.  
  152.       <p>For more information on access control directives, see
  153.       <module>mod_access</module>.</p>
  154.  
  155.       <p>Strictly limiting access is essential if you are using a
  156.       forward proxy (using the <directive
  157.       module="mod_proxy">ProxyRequests</directive> directive).
  158.       Otherwise, your server can be used by any client to access
  159.       arbitrary hosts while hiding his or her true identity.  This is
  160.       dangerous both for your network and for the Internet at large.
  161.       When using a reverse proxy (using the <directive
  162.       module="mod_proxy">ProxyPass</directive> directive with
  163.       <code>ProxyRequests Off</code>), access control is less
  164.       critical because clients can only contact the hosts that you
  165.       have specifically configured.</p>
  166.  
  167.     </section> <!-- /access -->
  168.  
  169.    <section id="ftp-proxy"><title>FTP Proxy</title>
  170.  
  171.  
  172.     <section id="mimetypes"><title>Why doesn't file type <var>xxx</var>
  173.     download via FTP?</title>
  174.       <p>You probably don't have that particular file type defined as
  175.       <code>application/octet-stream</code> in your proxy's mime.types
  176.       configuration file. A useful line can be</p>
  177.  
  178.       <example>
  179. <pre>application/octet-stream   bin dms lha lzh exe class tgz taz</pre>
  180.       </example>
  181.     </section> <!-- /mimetypes -->
  182.  
  183.     <section id="type"><title>How can I force an FTP ASCII download of
  184.     File <var>xxx</var>?</title>
  185.       <p>In the rare situation where you must download a specific file using the
  186.       FTP <code>ASCII</code> transfer method (while the default transfer is in
  187.       <code>binary</code> mode), you can override <module>mod_proxy</module>'s
  188.       default by suffixing the request with <code>;type=a</code> to force an
  189.       ASCII transfer. (FTP Directory listings are always executed in ASCII mode,
  190.       however.)</p>
  191.     </section> <!-- /type -->
  192.  
  193.     <section id="percent2fhck"><title>How can I access FTP files outside
  194.     of my home directory?</title>
  195.       <p>An FTP URI is interpreted relative to the home directory of the user
  196.       who is logging in. Alas, to reach higher directory levels you cannot
  197.       use /../, as the dots are interpreted by the browser and not actually
  198.       sent to the FTP server. To address this problem, the so called <dfn>Squid
  199.       %2f hack</dfn> was implemented in the Apache FTP proxy; it is a
  200.       solution which is also used by other popular proxy servers like the <a
  201.       href="http://www.squid-cache.org/">Squid Proxy Cache</a>. By
  202.       prepending <code>/%2f</code> to the path of your request, you can make
  203.       such a proxy change the FTP starting directory to <code>/</code> (instead
  204.       of the home directory). For example, to retrieve the file
  205.       <code>/etc/motd</code>, you would use the URL:</p>
  206.  
  207.       <example>
  208.         ftp://<var>user</var>@<var>host</var>/%2f/etc/motd
  209.       </example>
  210.     </section> <!-- /percent2fhck -->
  211.  
  212.     <section id="ftppass"><title>How can I hide the FTP cleartext password
  213.     in my browser's URL line?</title>
  214.       <p>To log in to an FTP server by username and password, Apache uses
  215.       different strategies. In absense of a user name and password in the URL
  216.       altogether, Apache sends an anonymous login to the FTP server,
  217.       <em>i.e.</em>,</p>
  218.  
  219.       <example>
  220.         user: anonymous<br />
  221.         password: apache_proxy@
  222.       </example>
  223.  
  224.       <p>This works for all popular FTP servers which are configured for
  225.       anonymous access.</p>
  226.  
  227.       <p>For a personal login with a specific username, you can embed the user
  228.       name into the URL, like in:</p>
  229.  
  230.       <example>
  231.         ftp://<var>username</var>@<var>host</var>/myfile
  232.       </example>
  233.  
  234.       <p>If the FTP server asks for a password when given this username (which
  235.       it should), then Apache will reply with a <code>401</code> (Authorization
  236.       required) response, which causes the Browser to pop up the
  237.       username/password dialog. Upon entering the password, the connection
  238.       attempt is retried, and if successful, the requested resource is
  239.       presented. The advantage of this procedure is that your browser does not
  240.       display the password in cleartext (which it would if you had used</p>
  241.  
  242.       <example>
  243.         ftp://<var>username</var>:<var>password</var>@<var>host</var>/myfile
  244.       </example>
  245.  
  246.       <p>in the first place).</p>
  247.  
  248.       <note><title>Note</title>
  249.         <p>The password which is transmitted in such a way is not encrypted on
  250.         its way. It travels between your browser and the Apache proxy server in
  251.         a base64-encoded cleartext string, and between the Apache proxy and the
  252.         FTP server as plaintext. You should therefore think twice before
  253.         accessing your FTP server via HTTP (or before accessing your personal
  254.         files via FTP at all!) When using unsecure channels, an eavesdropper
  255.         might intercept your password on its way.</p>
  256.       </note>
  257.     </section> <!-- /ftppass -->
  258.    </section> <!-- /ftpproxy -->
  259.     <section id="startup"><title>Slow Startup</title>
  260.       <p>If you're using the <directive module="mod_proxy"
  261.       >ProxyBlock</directive> directive, hostnames' IP addresses are looked up
  262.       and cached during startup for later match test. This may take a few
  263.       seconds (or more) depending on the speed with which the hostname lookups
  264.       occur.</p>
  265.     </section> <!-- /startup -->
  266.  
  267.     <section id="intranet"><title>Intranet Proxy</title>
  268.       <p>An Apache proxy server situated in an intranet needs to forward
  269.       external requests through the company's firewall (for this, configure
  270.       the <directive module="mod_proxy">ProxyRemote</directive> directive
  271.       to forward the respective <var>scheme</var> to the firewall proxy).
  272.       However, when it has to
  273.       access resources within the intranet, it can bypass the firewall when
  274.       accessing hosts. The <directive module="mod_proxy">NoProxy</directive>
  275.       directive is useful for specifying which hosts belong to the intranet and
  276.       should be accessed directly.</p>
  277.  
  278.       <p>Users within an intranet tend to omit the local domain name from their
  279.       WWW requests, thus requesting "http://somehost/" instead of
  280.       <code>http://somehost.example.com/</code>. Some commercial proxy servers
  281.       let them get away with this and simply serve the request, implying a
  282.       configured local domain. When the <directive module="mod_proxy"
  283.       >ProxyDomain</directive> directive is used and the server is <a
  284.       href="#proxyrequests">configured for proxy service</a>, Apache can return
  285.       a redirect response and send the client to the correct, fully qualified,
  286.       server address. This is the preferred method since the user's bookmark
  287.       files will then contain fully qualified hosts.</p>
  288.     </section> <!-- /intranet -->
  289.  
  290.     <section id="envsettings"><title>Protocol Adjustments</title>
  291.       <p>For circumstances where you have a application server which doesn't
  292.       implement keepalives or HTTP/1.1 properly, there are 2 environment
  293.       variables which when set send a HTTP/1.0 with no keepalive. These are set
  294.       via the  <directive module="mod_env">SetEnv</directive> directive.</p>
  295.  
  296.       <p>These are the <code>force-proxy-request-1.0</code> and
  297.       <code>proxy-nokeepalive</code> notes.</p>
  298.  
  299.       <example>
  300.         <Location /buggyappserver/><br />
  301.         <indent>
  302.           ProxyPass http://buggyappserver:7001/foo/<br />
  303.           SetEnv force-proxy-request-1.0 1<br />
  304.           SetEnv proxy-nokeepalive 1<br />
  305.         </indent>
  306.         </Location>
  307.       </example>
  308.     </section> <!-- /envsettings -->
  309.  
  310. <directivesynopsis type="section">
  311. <name>Proxy</name>
  312. <description>Container for directives applied to proxied resources</description>
  313. <syntax><Proxy <var>wildcard-url</var>> ...</Proxy></syntax>
  314. <contextlist><context>server config</context><context>virtual host</context>
  315. </contextlist>
  316.  
  317. <usage>
  318.     <p>Directives placed in <directive type="section">Proxy</directive>
  319.     sections apply only to matching proxied content.  Shell-style wildcards are
  320.     allowed.</p>
  321.  
  322.     <p>For example, the following will allow only hosts in
  323.     <code>yournetwork.example.com</code> to access content via your proxy
  324.     server:</p>
  325.  
  326.     <example>
  327.       <Proxy *><br />
  328.       <indent>
  329.         Order Deny,Allow<br />
  330.         Deny from all<br />
  331.         Allow from yournetwork.example.com<br />
  332.       </indent>
  333.       </Proxy>
  334.     </example>
  335.  
  336.     <p>The following example will process all files in the <code>foo</code>
  337.     directory of <code>example.com</code> through the <code>INCLUDES</code>
  338.     filter when they are sent through the proxy server:</p>
  339.  
  340.     <example>
  341.       <Proxy http://example.com/foo/*><br />
  342.       <indent>
  343.         SetOutputFilter INCLUDES<br />
  344.       </indent>
  345.       </Proxy>
  346.     </example>
  347. </usage>
  348. </directivesynopsis>
  349.  
  350. <directivesynopsis>
  351. <name>ProxyBadHeader</name>
  352. <description>Determines how to handle bad header lines in a
  353. response</description>
  354. <syntax>ProxyBadHeader IsError|Ignore|StartBody</syntax>
  355. <default>ProxyBadHeader IsError</default>
  356. <contextlist><context>server config</context><context>virtual host</context>
  357. </contextlist>
  358. <compatibility>available in Apache 2.0.44 and later</compatibility>
  359.  
  360. <usage>
  361.     <p>The <directive>ProxyBadHeader</directive> directive determines the
  362.     behaviour of <module>mod_proxy</module> if it receives syntactically invalid
  363.     header lines (<em>i.e.</em> containing no colon). The following arguments
  364.     are possible:</p>
  365.  
  366.     <dl>
  367.     <dt><code>IsError</code></dt>
  368.     <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
  369.     the default behaviour.</dd>
  370.  
  371.     <dt><code>Ignore</code></dt>
  372.     <dd>Treat bad header lines as if they weren't sent.</dd>
  373.  
  374.     <dt><code>StartBody</code></dt>
  375.     <dd>When receiving the first bad header line, finish reading the headers and
  376.     treat the remainder as body. This helps to work around buggy backend servers
  377.     which forget to insert an empty line between the headers and the body.</dd>
  378.     </dl>
  379. </usage>
  380. </directivesynopsis>
  381.  
  382. <directivesynopsis type="section">
  383. <name>ProxyMatch</name>
  384. <description>Container for directives applied to regular-expression-matched 
  385. proxied resources</description>
  386. <syntax><ProxyMatch <var>regex</var>> ...</ProxyMatch></syntax>
  387. <contextlist><context>server config</context><context>virtual host</context>
  388. </contextlist>
  389.  
  390. <usage>
  391.     <p>The <directive type="section">ProxyMatch</directive> directive is
  392.     identical to the <directive module="mod_proxy"
  393.     type="section">Proxy</directive> directive, except it matches URLs
  394.     using regular expressions.</p>
  395. </usage>
  396. </directivesynopsis>
  397.  
  398. <directivesynopsis>
  399. <name>ProxyPreserveHost</name>
  400. <description>Use incoming Host HTTP request header for proxy
  401. request</description>
  402. <syntax>ProxyPreserveHost On|Off</syntax>
  403. <default>ProxyPreserveHost Off</default>
  404. <contextlist><context>server config</context><context>virtual host</context>
  405. </contextlist>
  406. <compatibility>Available in Apache 2.0.31 and later.</compatibility>
  407.  
  408. <usage>
  409.     <p>When enabled, this option will pass the Host: line from the incoming
  410.     request to the proxied host, instead of the hostname specified in the
  411.     proxypass line.</p>
  412.  
  413.     <p>This option should normally be turned <code>Off</code>. It is mostly 
  414.     useful in special configurations like proxied mass name-based virtual
  415.     hosting, where the original Host header needs to be evaluated by the
  416.     backend server.</p>
  417. </usage>
  418. </directivesynopsis>
  419.  
  420. <directivesynopsis>
  421. <name>ProxyRequests</name>
  422. <description>Enables forward (standard) proxy requests</description>
  423. <syntax>ProxyRequests On|Off</syntax>
  424. <default>ProxyRequests Off</default>
  425. <contextlist><context>server config</context><context>virtual host</context>
  426. </contextlist>
  427.  
  428. <usage>
  429.     <p>This allows or prevents Apache from functioning as a forward proxy
  430.     server. (Setting ProxyRequests to <code>Off</code> does not disable use of
  431.     the <directive module="mod_proxy">ProxyPass</directive> directive.)</p>
  432.  
  433.     <p>In a typical reverse proxy configuration, this option should be set to
  434.     <code>Off</code>.</p>
  435.  
  436.     <p>In order to get the functionality of proxying HTTP or FTP sites, you
  437.     need also <module>mod_proxy_http</module> or <module>mod_proxy_ftp</module>
  438.     (or both) present in the server.</p>
  439.  
  440.     <note type="warning"><title>Warning</title>
  441.       <p>Do not enable proxying with <directive
  442.       module="mod_proxy">ProxyRequests</directive> until you have <a
  443.       href="#access">secured your server</a>.  Open proxy servers are dangerous
  444.       both to your network and to the Internet at large.</p>
  445.     </note>
  446. </usage>
  447. </directivesynopsis>
  448.  
  449. <directivesynopsis>
  450. <name>ProxyRemote</name>
  451. <description>Remote proxy used to handle certain requests</description>
  452. <syntax>ProxyRemote <var>match</var> <var>remote-server</var></syntax>
  453. <contextlist><context>server config</context><context>virtual host</context>
  454. </contextlist>
  455.  
  456. <usage>
  457.     <p>This defines remote proxies to this proxy. <var>match</var> is either the
  458.     name of a URL-scheme that the remote server supports, or a partial URL
  459.     for which the remote server should be used, or <code>*</code> to indicate
  460.     the server should be contacted for all requests. <var>remote-server</var> is
  461.     a partial URL for the remote server. Syntax:</p>
  462.  
  463.     <example>
  464.       <dfn>remote-server</dfn> =
  465.           <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
  466.     </example>
  467.  
  468.     <p><var>scheme</var> is effectively the protocol that should be used to
  469.     communicate with the remote server; only <code>http</code> is supported by
  470.     this module.</p>
  471.  
  472.     <example><title>Example</title>
  473.       ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000<br />
  474.       ProxyRemote * http://cleversite.com<br />
  475.       ProxyRemote ftp http://ftpproxy.mydomain.com:8080
  476.     </example>
  477.  
  478.     <p>In the last example, the proxy will forward FTP requests, encapsulated
  479.     as yet another HTTP proxy request, to another proxy which can handle
  480.     them.</p>
  481.  
  482.     <p>This option also supports reverse proxy configuration - a backend
  483.     webserver can be embedded within a virtualhost URL space even if that
  484.     server is hidden by another forward proxy.</p>
  485. </usage>
  486. </directivesynopsis>
  487.  
  488. <directivesynopsis>
  489. <name>ProxyRemoteMatch</name>
  490. <description>Remote proxy used to handle requests matched by regular
  491. expressions</description>
  492. <syntax>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></syntax>
  493. <contextlist><context>server config</context><context>virtual host</context>
  494. </contextlist>
  495.  
  496. <usage>
  497.     <p>The <directive>ProxyRemoteMatch</directive> is identical to the
  498.     <directive module="mod_proxy">ProxyRemote</directive> directive, except the
  499.     first argument is a regular expression match against the requested URL.</p>
  500. </usage>
  501. </directivesynopsis>
  502.  
  503. <directivesynopsis>
  504. <name>ProxyPass</name>
  505. <description>Maps remote servers into the local server URL-space</description>
  506. <syntax>ProxyPass [<var>path</var>] !|<var>url</var></syntax>
  507. <contextlist><context>server config</context><context>virtual host</context>
  508. <context>directory</context>
  509. </contextlist>
  510.  
  511. <usage>
  512.     <p>This directive allows remote servers to be mapped into the space of
  513.     the local server; the local server does not act as a proxy in the
  514.     conventional sense, but appears to be a mirror of the remote
  515.     server. <var>path</var> is the name of a local virtual path; <var>url</var>
  516.     is a partial URL for the remote server and cannot include a query
  517.     string.</p>
  518.  
  519.     <p>Suppose the local server has address <code>http://example.com/</code>;
  520.     then</p>
  521.  
  522.     <example>
  523.       ProxyPass /mirror/foo/ http://backend.example.com/
  524.     </example>
  525.  
  526.     <p>will cause a local request for
  527.     <code>http://example.com/mirror/foo/bar</code> to be internally converted
  528.     into a proxy request to <code>http://backend.example.com/bar</code>.</p>
  529.  
  530.     <p>The <code>!</code> directive is useful in situations where you don't want
  531.     to reverse-proxy a subdirectory, <em>e.g.</em></p>
  532.  
  533.     <example>
  534.       ProxyPass /mirror/foo/i !<br />
  535.       ProxyPass /mirror/foo http://backend.example.com
  536.     </example>
  537.  
  538.     <p>will proxy all requests to <code>/mirror/foo</code> to
  539.     <code>backend.example.com</code> <em>except</em> requests made to
  540.     <code>/mirror/foo/i</code>.</p>
  541.  
  542.     <note><title>Note</title>
  543.       <p>Order is important. you need to put the exclusions <em>before</em> the
  544.       general proxypass directive.</p>
  545.     </note>
  546.  
  547.     <p>When used inside a <directive type="section" module="core"
  548.     >Location</directive> section, the first argument is omitted and the local
  549.     directory is obtained from the <directive type="section" module="core"
  550.     >Location</directive>.</p>
  551.  
  552.     <note type="warning">The <directive
  553.     module="mod_proxy">ProxyRequests</directive> directive should
  554.     usually be set <strong>off</strong> when using
  555.     <directive>ProxyPass</directive>.</note>
  556.  
  557.     <p>If you require a more flexible reverse-proxy configuration, see the
  558.     <directive module="mod_rewrite">RewriteRule</directive> directive with the
  559.     <code>[P]</code> flag.</p>
  560. </usage>
  561. </directivesynopsis>
  562.  
  563. <directivesynopsis>
  564. <name>ProxyPassReverse</name>
  565. <description>Adjusts the URL in HTTP response headers sent from a reverse
  566. proxied server</description>
  567. <syntax>ProxyPassReverse [<var>path</var>] <var>url</var></syntax>
  568. <contextlist><context>server config</context><context>virtual host</context>
  569. <context>directory</context>
  570. </contextlist>
  571.  
  572. <usage>
  573.     <p>This directive lets Apache adjust the URL in the <code>Location</code>,
  574.     <code>Content-Location</code> and <code>URI</code> headers on HTTP redirect
  575.     responses. This is essential when Apache is used as a reverse proxy to avoid
  576.     by-passing the reverse proxy because of HTTP redirects on the backend
  577.     servers which stay behind the reverse proxy.</p>
  578.  
  579.     <p>Only the HTTP response headers specifically mentioned above
  580.     will be rewritten.  Apache will not rewrite other response
  581.     headers, nor will it rewrite URL references inside HTML pages.
  582.     This means that if the proxied content contains absolute URL
  583.     references, they will by-pass the proxy.  A third-party module
  584.     that will look inside the HTML and rewrite URL references is Nick
  585.     Kew's <a href="http://www.webthing.com/software/mod_proxy_html/"
  586.     >mod_proxy_html</a>.</p>
  587.  
  588.     <p><var>path</var> is the name of a local virtual path. <var>url</var> is a
  589.     partial URL for the remote server - the same way they are used for the
  590.     <directive module="mod_proxy">ProxyPass</directive> directive.</p>
  591.  
  592.     <p>For example, suppose the local server has address
  593.     <code>http://example.com/</code>; then</p>
  594.  
  595.     <example>
  596.       ProxyPass         /mirror/foo/ http://backend.example.com/<br />
  597.       ProxyPassReverse  /mirror/foo/ http://backend.example.com/
  598.     </example>
  599.  
  600.     <p>will not only cause a local request for the
  601.     <code>http://example.com/mirror/foo/bar</code> to be internally converted
  602.     into a proxy request to <code>http://backend.example.com/bar</code>
  603.     (the functionality <code>ProxyPass</code> provides here). It also takes care
  604.     of redirects the server <code>backend.example.com</code> sends: when
  605.     <code>http://backend.example.com/bar</code> is redirected by him to
  606.     <code>http://backend.example.com/quux</code> Apache adjusts this to
  607.     <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
  608.     redirect response to the client. Note that the hostname used for
  609.     constructing the URL is chosen in respect to the setting of the <directive
  610.     module="core">UseCanonicalName</directive> directive.</p>
  611.  
  612.     <p>Note that this <directive>ProxyPassReverse</directive> directive can
  613.     also be used in conjunction with the proxy pass-through feature
  614.     (<code>RewriteRule ...  [P]</code>) from <module>mod_rewrite</module>
  615.     because its doesn't depend on a corresponding <directive module="mod_proxy"
  616.     >ProxyPass</directive> directive.</p>
  617.  
  618.     <p>When used inside a <directive type="section" module="core"
  619.     >Location</directive> section, the first argument is omitted and the local
  620.     directory is obtained from the <directive type="section" module="core"
  621.     >Location</directive>.</p>
  622. </usage>
  623. </directivesynopsis>
  624.  
  625. <directivesynopsis>
  626. <name>AllowCONNECT</name>
  627. <description>Ports that are allowed to <code>CONNECT</code> through the
  628. proxy</description>
  629. <syntax>AllowCONNECT <var>port</var> [<var>port</var>] ...</syntax>
  630. <default>AllowCONNECT 443 563</default>
  631. <contextlist><context>server config</context><context>virtual host</context>
  632. </contextlist>
  633.  
  634. <usage>
  635.     <p>The <directive>AllowCONNECT</directive> directive specifies a list
  636.     of port numbers to which the proxy <code>CONNECT</code> method may
  637.     connect.  Today's browsers use this method when a <code>https</code>
  638.     connection is requested and proxy tunneling over HTTP is in effect.</p>
  639.  
  640.     <p>By default, only the default https port (<code>443</code>) and the
  641.     default snews port (<code>563</code>) are enabled. Use the
  642.     <directive>AllowCONNECT</directive> directive to override this default and
  643.     allow connections to the listed ports only.</p>
  644.  
  645.     <p>Note that you'll need to have <module>mod_proxy_connect</module> present
  646.     in the server in order to get the support for the <code>CONNECT</code> at
  647.     all.</p>
  648. </usage>
  649. </directivesynopsis>
  650.  
  651. <directivesynopsis>
  652. <name>ProxyBlock</name>
  653. <description>Words, hosts, or domains that are banned from being
  654. proxied</description>
  655. <syntax>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>
  656. [<var>word</var>|<var>host</var>|<var>domain</var>] ...</syntax>
  657. <contextlist><context>server config</context><context>virtual host</context>
  658. </contextlist>
  659.  
  660. <usage>
  661.     <p>The <directive>ProxyBlock</directive> directive specifies a list of
  662.     words, hosts and/or domains, separated by spaces.  HTTP, HTTPS, and
  663.     FTP document requests to sites whose names contain matched words,
  664.     hosts or domains are <em>blocked</em> by the proxy server. The proxy
  665.     module will also attempt to determine IP addresses of list items which
  666.     may be hostnames during startup, and cache them for match test as
  667.     well. That may slow down the startup time of the server.</p>
  668.  
  669.     <example><title>Example</title>
  670.       ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu
  671.     </example>
  672.  
  673.     <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by
  674.     IP address.</p>
  675.  
  676.     <p>Note that <code>wotsamattau</code> would also be sufficient to match
  677.     <code>wotsamattau.edu</code>.</p>
  678.  
  679.     <p>Note also that</p>
  680.  
  681.     <example>
  682.       ProxyBlock *
  683.     </example>
  684.  
  685.     <p>blocks connections to all sites.</p>
  686. </usage>
  687. </directivesynopsis>
  688.  
  689. <directivesynopsis>
  690. <name>ProxyReceiveBufferSize</name>
  691. <description>Network buffer size for proxied HTTP and FTP
  692. connections</description>
  693. <syntax>ProxyReceiveBufferSize <var>bytes</var></syntax>
  694. <default>ProxyReceiveBufferSize 0</default>
  695. <contextlist><context>server config</context><context>virtual host</context>
  696. </contextlist>
  697.  
  698. <usage>
  699.     <p>The <directive>ProxyReceiveBufferSize</directive> directive specifies an
  700.     explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
  701.     for increased throughput. It has to be greater than <code>512</code> or set
  702.     to <code>0</code> to indicate that the system's default buffer size should
  703.     be used.</p>
  704.  
  705.     <example><title>Example</title>
  706.       ProxyReceiveBufferSize 2048
  707.     </example>
  708. </usage>
  709. </directivesynopsis>
  710.  
  711. <directivesynopsis>
  712. <name>ProxyIOBufferSize</name>
  713. <description>Determine size of internal data throughput buffer</description>
  714. <syntax>ProxyIOBufferSize <var>bytes</var></syntax>
  715. <default>ProxyIOBufferSize 8192</default>
  716. <contextlist><context>server config</context><context>virtual host</context>
  717. </contextlist>
  718.  
  719. <usage>
  720.     <p>The <directive>ProxyIOBufferSize</directive> directive adjusts the size
  721.     of the internal buffer, which is used as a scratchpad for the data between
  722.     input and output. The size must be less or equal <code>8192</code>.</p>
  723.  
  724.     <p>In almost every case there's no reason to change that value.</p>
  725. </usage>
  726. </directivesynopsis>
  727.  
  728. <directivesynopsis>
  729. <name>ProxyMaxForwards</name>
  730. <description>Maximium number of proxies that a request can be forwarded
  731. through</description>
  732. <syntax>ProxyMaxForwards <var>number</var></syntax>
  733. <default>ProxyMaxForwards 10</default>
  734. <contextlist><context>server config</context><context>virtual host</context>
  735. </contextlist>
  736. <compatibility>Available in Apache 2.0 and later</compatibility>
  737.  
  738. <usage>
  739.     <p>The <directive>ProxyMaxForwards</directive> directive specifies the
  740.     maximum number of proxies through which a request may pass, if there's no
  741.     <code>Max-Forwards</code> header supplied with the request. This is
  742.     set to prevent infinite proxy loops, or a DoS attack.</p>
  743.  
  744.     <example><title>Example</title>
  745.       ProxyMaxForwards 15
  746.     </example>
  747. </usage>
  748. </directivesynopsis>
  749.  
  750. <directivesynopsis>
  751. <name>NoProxy</name>
  752. <description>Hosts, domains, or networks that will be connected to
  753. directly</description>
  754. <syntax>NoProxy <var>host</var> [<var>host</var>] ...</syntax>
  755. <contextlist><context>server config</context><context>virtual host</context>
  756. </contextlist>
  757.  
  758. <usage>
  759.     <p>This directive is only useful for Apache proxy servers within
  760.     intranets.  The <directive>NoProxy</directive> directive specifies a
  761.     list of subnets, IP addresses, hosts and/or domains, separated by
  762.     spaces. A request to a host which matches one or more of these is
  763.     always served directly, without forwarding to the configured
  764.     <directive module="mod_proxy">ProxyRemote</directive> proxy server(s).</p>
  765.  
  766.     <example><title>Example</title>
  767.       ProxyRemote  *  http://firewall.mycompany.com:81<br />
  768.       NoProxy         .mycompany.com 192.168.112.0/21
  769.     </example>
  770.  
  771.     <p>The <var>host</var> arguments to the <directive>NoProxy</directive>
  772.     directive are one of the following type list:</p>
  773.  
  774.     <dl>
  775.     <!-- ===================== Domain ======================= -->
  776.     <dt><var><a name="domain" id="domain">Domain</a></var></dt>
  777.     <dd>
  778.     <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
  779.     by a period. It represents a list of hosts which logically belong to the
  780.     same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
  781.     all ending in <var>Domain</var>).</p>
  782.  
  783.     <example><title>Examples</title>
  784.       .com .apache.org.
  785.     </example>
  786.  
  787.     <p>To distinguish <var>Domain</var>s from <var><a href="#hostname"
  788.     >Hostname</a></var>s (both syntactically and semantically; a DNS domain can
  789.     have a DNS A record, too!), <var>Domain</var>s are always written with a
  790.     leading period.</p>
  791.     
  792.     <note><title>Note</title>
  793.       <p>Domain name comparisons are done without regard to the case, and
  794.       <var>Domain</var>s are always assumed to be anchored in the root of the
  795.       DNS tree, therefore two domains <code>.MyDomain.com</code> and
  796.       <code>.mydomain.com.</code> (note the trailing period) are considered
  797.       equal. Since a domain comparison does not involve a DNS lookup, it is much
  798.       more efficient than subnet comparison.</p>
  799.     </note></dd>
  800.  
  801.     <!-- ===================== SubNet ======================= -->
  802.     <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
  803.     <dd>
  804.     <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
  805.     numeric (dotted quad) form, optionally followed by a slash and the netmask,
  806.     specified as the number of significant bits in the <var>SubNet</var>. It is
  807.     used to represent a subnet of hosts which can be reached over a common
  808.     network interface. In the absence of the explicit net mask it is assumed
  809.     that omitted (or zero valued) trailing digits specify the mask. (In this
  810.     case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
  811.  
  812.     <dl>
  813.     <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
  814.     <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
  815.     (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
  816.     <dt><code>192.168.112.0/21</code></dt>
  817.     <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
  818.     valid bits (also used in the form 255.255.248.0)</dd>
  819.     </dl>
  820.  
  821.     <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
  822.     equivalent to an <var><a href="#ipadr">IPAddr</a></var>, while a <var>SubNet</var> with zero
  823.     valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
  824.     <var>_Default_</var>, matching any IP address.</p></dd>
  825.  
  826.     <!-- ===================== IPAddr ======================= -->
  827.     <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
  828.     <dd>
  829.     <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
  830.     numeric (dotted quad) form. Usually, this address represents a host, but
  831.     there need not necessarily be a DNS domain name connected with the
  832.     address.</p>
  833.     <example><title>Example</title>
  834.       192.168.123.7
  835.     </example>
  836.     
  837.     <note><title>Note</title>
  838.       <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
  839.       it can result in more effective apache performance.</p>
  840.     </note></dd>
  841.  
  842.     <!-- ===================== Hostname ======================= -->
  843.     <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
  844.     <dd>
  845.     <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
  846.     be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
  847.     DNS domain name service. It represents a logical host (in contrast to
  848.     <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
  849.     to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
  850.     of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
  851.  
  852.     <example><title>Examples</title>
  853.       prep.ai.mit.edu<br />
  854.       www.apache.org
  855.     </example>
  856.  
  857.     <note><title>Note</title>
  858.       <p>In many situations, it is more effective to specify an <var><a
  859.       href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a
  860.       DNS lookup can be avoided. Name resolution in Apache can take a remarkable
  861.       deal of time when the connection to the name server uses a slow PPP
  862.       link.</p>
  863.       <p><var>Hostname</var> comparisons are done without regard to the case,
  864.       and <var>Hostname</var>s are always assumed to be anchored in the root
  865.       of the DNS tree, therefore two hosts <code>WWW.MyDomain.com</code>
  866.       and <code>www.mydomain.com.</code> (note the trailing period) are
  867.       considered equal.</p>
  868.      </note></dd>
  869.     </dl>
  870. </usage>
  871. <seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
  872. </directivesynopsis>
  873.  
  874. <directivesynopsis>
  875. <name>ProxyTimeout</name>
  876. <description>Network timeout for proxied requests</description>
  877. <syntax>ProxyTimeout <var>seconds</var></syntax>
  878. <default>ProxyTimeout 300</default>
  879. <contextlist><context>server config</context><context>virtual host</context>
  880. </contextlist>
  881. <compatibility>Available in Apache 2.0.31 and later</compatibility>
  882.  
  883. <usage>
  884.     <p>This directive allows a user to specifiy a timeout on proxy requests.
  885.     This is useful when you have a slow/buggy appserver which hangs, and you
  886.     would rather just return a timeout and fail gracefully instead of waiting
  887.     however long it takes the server to return.</p>
  888. </usage>
  889. </directivesynopsis>
  890.  
  891. <directivesynopsis>
  892. <name>ProxyDomain</name>
  893. <description>Default domain name for proxied requests</description>
  894. <syntax>ProxyDomain <var>Domain</var></syntax>
  895. <contextlist><context>server config</context><context>virtual host</context>
  896. </contextlist>
  897.  
  898. <usage>
  899.     <p>This directive is only useful for Apache proxy servers within
  900.     intranets. The <directive>ProxyDomain</directive> directive specifies
  901.     the default domain which the apache proxy server will belong to. If a
  902.     request to a host without a domain name is encountered, a redirection
  903.     response to the same host with the configured <var>Domain</var> appended
  904.     will be generated.</p>
  905.  
  906.     <example><title>Example</title>
  907.       ProxyRemote  *  http://firewall.mycompany.com:81<br />
  908.       NoProxy         .mycompany.com 192.168.112.0/21<br />
  909.       ProxyDomain     .mycompany.com
  910.     </example>
  911. </usage>
  912. </directivesynopsis>
  913.  
  914. <directivesynopsis>
  915. <name>ProxyVia</name>
  916. <description>Information provided in the <code>Via</code> HTTP response
  917. header for proxied requests</description>
  918. <syntax>ProxyVia On|Off|Full|Block</syntax>
  919. <default>ProxyVia Off</default>
  920. <contextlist><context>server config</context><context>virtual host</context>
  921. </contextlist>
  922.  
  923. <usage>
  924.     <p>This directive controls the use of the <code>Via:</code> HTTP
  925.     header by the proxy. Its intended use is to control the flow of of
  926.     proxy requests along a chain of proxy servers.  See <a
  927.     href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> (HTTP/1.1), section
  928.     14.45 for an explanation of <code>Via:</code> header lines.</p>
  929.  
  930.     <ul>
  931.     <li>If set to <code>Off</code>, which is the default, no special processing
  932.     is performed. If a request or reply contains a <code>Via:</code> header,
  933.     it is passed through unchanged.</li>
  934.  
  935.     <li>If set to <code>On</code>, each request and reply will get a
  936.     <code>Via:</code> header line added for the current host.</li>
  937.  
  938.     <li>If set to <code>Full</code>, each generated <code>Via:</code> header
  939.     line will additionally have the Apache server version shown as a
  940.     <code>Via:</code> comment field.</li>
  941.  
  942.     <li>If set to <code>Block</code>, every proxy request will have all its
  943.     <code>Via:</code> header lines removed. No new <code>Via:</code> header will
  944.     be generated.</li>
  945.     </ul>
  946. </usage>
  947. </directivesynopsis>
  948.  
  949. <directivesynopsis>
  950. <name>ProxyErrorOverride</name>
  951. <description>Override error pages for proxied content</description>
  952. <syntax>ProxyErrorOverride On|Off</syntax>
  953. <default>ProxyErrorOverride Off</default>
  954. <contextlist><context>server config</context><context>virtual host</context>
  955. </contextlist>
  956. <compatibility>Available in version 2.0 and later</compatibility>
  957.  
  958. <usage>
  959.     <p>This directive is useful for reverse-proxy setups, where you want to 
  960.     have a common look and feel on the error pages seen by the end user. 
  961.     This also allows for included files (via mod_include's SSI) to get
  962.     the error code and act accordingly (default behavior would display
  963.     the error page of the proxied server, turning this on shows the SSI
  964.     Error message).</p>
  965. </usage>
  966. </directivesynopsis>
  967.  
  968. </modulesynopsis>
  969.